<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>等级编辑</title>
    <!-- 引入公用部分 -->
    <script th:replace="common/head::static"></script>
</head>
<script type="text/javascript">
    var eq = '[[${eq}]]';
    var levelData = JSON.parse(localStorage.getItem('levelEdit_data'));
    // 用户信息
    let jwtOb = JSON.parse(localStorage.getItem('auth_token'));
    var tree;
    var table;
    var element;
    var headers = {
        // Basic bearer
        'Authorization':'Basic '+jwtOb.additionalInformation.jti
    }
    layui.use(['element', 'form', 'tree', 'laydate'], function () {
        var form = layui.form;
        element = layui.element;
        tree = layui.tree;
        table = layui.table;
        var laydate = layui.laydate;
        if (eq == 'add') {
            //重置操作表单
            $("#levelForm")[0].reset();
            form.render();
        }else if (eq === 'edit') {
            //回显操作表单
            $("#levelForm").form(levelData);
            form.render();
        }
    });
</script>
<body>
<div class="layui-row layui-col-space15">
    <input name="eq" th:hidden="${eq}"/>
    <!-- 操作表单 -->
    <div class="layui-col-md6">
        <div class="layui-card">
            <div class="layui-card-body">
                <form id="levelForm" class="layui-form layui-form-pane">
                    <div class="layui-form-item">
                        <label class="layui-form-label">等级名</label>
                        <div class="layui-input-block">
                            <input type="text" name="levelName" autocomplete="off" placeholder="等级名"
                                   class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <input type="text" name="levelRemark" autocomplete="off" placeholder="备注"
                                   class="layui-input">
                        </div>
                    </div>
                    <!-- 隐藏域 -->
                    <input type="text" name="levelId" hidden="hidden" value=""/>
                </form>


                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <a class="layui-btn" onclick="levelFormSave()">保存</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script th:inline="none" th:src="@{/common/js/level/levelEdit.js}"></script>
</html>